Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  List  the  Subnets  in  all  Active  Directory  Sites  

 Content of List the Subnets in all Active Directory Sites.vbs
MD5 Hash: 5170867E55643365B2028DF3247681FE
' Description: Lists subnets in all Active Directory sites.


Set objRootDSE = GetObject("LDAP://RootDSE")
strConfigurationNC = objRootDSE.Get("configurationNamingContext")

strSubnetsContainer = "LDAP://cn=Subnets,cn=Sites," & strConfigurationNC

Set objSubnetsContainer = GetObject(strSubnetsContainer)

objSubnetsContainer.Filter = Array("subnet")

Set objHash = CreateObject("Scripting.Dictionary")

For Each objSubnet In objSubnetsContainer
objSubnet.GetInfoEx Array("siteObject"), 0
strSiteObjectDN = objSubnet.Get("siteObject")
strSiteObjectName = Split(Split(strSiteObjectDN, ",")(0), "=")(1)

If objHash.Exists(strSiteObjectName) Then
objHash(strSiteObjectName) = objHash(strSiteObjectName) & "," & _
Split(objSubnet.Name, "=")(1)
Else
objHash.Add strSiteObjectName, Split(objSubnet.Name, "=")(1)
End If
Next

For Each strKey In objHash.Keys
WScript.Echo strKey & "," & objHash(strKey)
Next

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a